<!-- Generated automatically at 12/04/2011 -->
<div id="left-panel">
  <?php if (sizeof($advertisements) > 0) echo paginationBuildPagination($countFoundAdvertisements, $currentPage, MAX_ADS_PER_PAGE, MAX_PAGE_PER_SEGMENT) ?>
 
  <div id="advertisements">
  	<?php if(empty($advertisements)) : ?>
  		<div style="color: red; float: left; background-color: #ffffff; border: 1px solid #cccccc; width: 800px; padding: 5px;">Không tìm thấy kết quả nào tương ứng.</div>
  	<?php else : ?>
  		<?php foreach ($advertisements as $advertisement): ?>
  			<?php
				list($createdAtDate, $createdAtTime) = explode(' ', $advertisement->getCreatedAt());
				
				$thumbs = Advertisement::retrieveThumbs($advertisement->getId());
				$thumbUrl = $thumbs[0];
				
				$price = ($advertisement->getPrice() != 0) ? $advertisement->getPrice().' €' : '-';
				
				#build the link
				$advertisementLink = urlGenUrl($GLOBALS['page'], array('id'=>$advertisement->getId()));
			?>
  			<div class="advertisement">
  				<div class="created-at">
  				  <div class="date"><?php echo stringDateValueToText($createdAtDate) ?></div>
  				  <div class="time"><?php echo stringTimeValueToText($createdAtTime) ?></div>
  				</div>
  				<div class="thumb"><a href='<?php echo $advertisementLink ?>'><img src="<?php echo $thumbUrl ?>" /></a></div>
  				<div class="title"><a href='<?php echo $advertisementLink ?>'><?php echo $advertisement->getTitle() ?></a></div>
  				<div class="price"><b><?php echo $price ?></b></div>
  				<div class="category"><?php echo $advertisement->getCategoryName() ?></div>
  				<div class="town"><?php echo $advertisement->getTownName()." "."(".$advertisement->getTownCode().")" ?></div>
  			</div>
  		<?php endforeach; ?>
  	<?php endif; ?>
  </div>
  
  <?php if (sizeof($advertisements) > 0) echo paginationBuildPagination($countFoundAdvertisements, $currentPage, MAX_ADS_PER_PAGE, MAX_PAGE_PER_SEGMENT) ?>
</div>
<div id="right-panel" style="display:none;">
	<div class="right-ad">Ad space</div>
</div>
<div id="bottom-panel">
</div>
